package com.beone.admin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

import java.util.Properties;

/**
 * @title  FreeMarker 配置
 * @Author 覃球球
 * @Version 1.0 on 2018/11/27.
 * @Copyright 贝旺科技
 */
//@Configuration
public class FreeMarkerConfig {

//    @Bean
    public FreeMarkerConfigurer getFreeMarkerConfigurer(){
        FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
        configurer.setDefaultEncoding("UTF-8");
        configurer.setTemplateLoaderPath("classpath:/ftls/");
        Properties env = new Properties();
        env.setProperty("default_encoding", "UTF-8");
        env.setProperty("output_encoding", "UTF-8");
        env.setProperty("date_format", "yyyy-MM-dd");
        env.setProperty("time_format", "HH:mm:ss");
        env.setProperty("datetime_format", "yyyy-MM-dd HH:mm:ss");
        env.setProperty("number_format", "#,###.##");
        configurer.setFreemarkerSettings(env);
        return configurer;
    }
}